import httpRequest from '@/utils/hqqtRequest'

enum API {
    // 获取已有的SPU数据
    SPU_PRODUCT_URL = '/admin/product/',
    // 获取全部品牌的数据
    TRADEMARK_LIST = '/admin/product/baseTrademark/getTrademarkList',
    // 根据id获取SPU下的全部销售商品的图片数据
    TRADEMARK_LIST_IMG = '/admin/product/spuImageList/',
    // 根据id获取SPU下全部的已有的销售属性
    TRADEMARK_LIST_ATTR = '/admin/product/spuSaleAttrList/',
    // 获取全部销售属性 【颜色、版本、尺码】
    TRADEMARK_LIST_ATTR_ALL = '/admin/product/baseSaleAttrList',
    // 添加属性
    ADD_TRADEMARK_API = '/admin/product/saveSpuInfo',
    // 修改属性
    PUT_TRADEMARK_API = '/admin/product/updateSpuInfo',
    // 添加SKU
    ASS_SKU_API = '/admin/product/saveSkuInfo',
    // 根据id获取sku要展示的数据
    SPU_ID_SKU = '/admin/product/findBySpuId/',
    // 根据id删除sku数据
    DEL_ID_SKU = '/admin/product/deleteSpu/'
}

export const getProductSpuAPI = (page: number, limit: number, c3id: number | string) => httpRequest({ url: API.SPU_PRODUCT_URL + `${page}/${limit}?category3Id=${c3id}` })

export const getTrademarkListAPI = () => httpRequest({ url: API.TRADEMARK_LIST })

export const getTrademarkListImgAPI = (spuId: number | string) => httpRequest({ url: API.TRADEMARK_LIST_IMG + spuId })

export const getTrademarkListAttrAPI = (spuId: number | string) => httpRequest({ url: API.TRADEMARK_LIST_ATTR + spuId })

export const getTrademarkListAttrAllAPI = () => httpRequest({ url: API.TRADEMARK_LIST_ATTR_ALL })

export const addTrademarListAPI = (data: any) => httpRequest({ url: API.ADD_TRADEMARK_API, method: 'POST', data })

export const putTrademarListAPI = (data: any) => httpRequest({ url: API.PUT_TRADEMARK_API, method: 'POST', data })

export const addSkuAPI = (data: any) => httpRequest({ url: API.ASS_SKU_API, method: 'POST', data })

export const getSpuIdSkuAPI = (id: number | string) => httpRequest({ url: API.SPU_ID_SKU + id })

export const deleteSkuAPI = (id: number | string) => httpRequest({ url: API.DEL_ID_SKU + id, method: 'DELETE' })
